<html>
<body>
<p>Click the button to greet</p>
<button onclick="myFunction()">Try!</button>

<p id="demo"> </p>

<script>
	function myFunction()
	{
		var x="";
		var hr=new Date().getHours();		
		if(hr > 20)
		{
			x="Good night!"	;
		}else if(hr > 17)
		{
			x = "Good evening!";
		}else
		{
			x="Good morning";
		}
		document.getElementById("demo").innerHTML=x;

	}
</script>



</body>
</html>